﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using CrawlerManager;
using HtmlAgilityPack;
using NewsCrawler.Common.Models;

namespace PCnet
{
    public class PCnetArticle : BaseArticle
    {
        protected override string Folder
        {
            get { return "PCNet"; }
        }

        public override void Parse()
        {
            
        }

        private string GetImagePath(HtmlNode image, WebClient client)
        {
            string value = image.Attributes["src"].Value;
            string fileName = Path.Combine(GetImagePath(), Path.GetFileName(value));
            client.DownloadFile(value, fileName);
            return fileName;
        }

        private DateTime ParseTarih(string innerHtml)
        {
            DateTime date = new DateTime();
            string[] parsed = innerHtml.Replace(" ", "").Split(',');
            if (parsed[0] == "Bugün")
            {
                date = CrawlerHelper.CopyDateTime(date, DateTime.Today, new int[] { }, true);
                DateTime saat = DateTime.Parse(parsed[1]);
                date = CrawlerHelper.CopyDateTime(saat, date, new int[] { 2, 3 }, false);
            }
            else
            {
                date = DateTime.Parse(innerHtml);
            }


            return date;
        }
    }
}
